import React from 'react'
import {useSelector} from 'react-redux'
import {ReduxStateProps} from '../reducers'
import Taro, {useDidShow} from '@tarojs/taro'

export default function useAuth() {
  const user = useSelector((state: ReduxStateProps) => state.user)

  useDidShow(() => {
    if(user.nickName) return null

    Taro.switchTab({
      url: '/pages/me/index'
    })
  })
  
}
